package com.atfusu.controller;

import com.atfusu.bean.entity.Dict;
import com.atfusu.result.Result;
import com.atfusu.service.DictService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Title:
 * Author: fusu
 * DateTime:  2022/12/2
 * Description:
 **/
@Controller
@RequestMapping("/dict")
@ResponseBody
public class DictController {

    @DubboReference
    private DictService dictService;


    @RequestMapping("/findListByDictCode/{code}")
    public Result findListByDictCode(@PathVariable String code) {
        List<Dict> list = dictService.findListByDictCode(code);
        return Result.ok(list);
    }

    @RequestMapping("/findListByParentId/{parentId}")
    public Result findListByParentId(@PathVariable Long parentId) {
        List<Dict> list = dictService.findListByParentId(parentId);

        return Result.ok(list);
    }
}
